Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Hardhat WIP #274

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft

Hardhat WIP #274

wants to merge 21 commits into from

Conversation

hayesgm
Copy link
Contributor

@hayesgm hayesgm commented Apr 7, 2021

No description provided.

waynenilsen and others added 15 commits March 22, 2021 11:18
* also patch ETH_KEY_ID situation
* update integration tests to use CLI configuration
This patch adds a Gateway repl to make it easy to interact with a Gateway instance. For example, the following examples:

```sh
yarn repl -c testnet
```

Query the current cash yield

```sh
> (await api.query.cash.cashYield()).toJSON()
300
```

Show the current test-net block

```sh
> .block
```

Show the current test-net validators

```sh
> .validators
  5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL:
    substrate_id=0x1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c
    eth_address=0x286f2a10c28c966e97a72b8246041fbf636e673e

  5HMqNs9offzpiebeuzHVwKcJRid1L44KgEKF7jwpYYFM25kY:
    substrate_id=0xea3da7e5b24ee22ce5fa252136745bfbefcb657201404f4479bcbe42135e234c
    eth_address=0x4515e1ce5d4c42da4b0561f52ef12dee19f9c020

  5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty:
    substrate_id=0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48
    eth_address=0xc9b0c3ed4efa833a7ad5459755a18f9689a0f7ac

  5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY:
    substrate_id=0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
    eth_address=0x55413a2d4908d130c908ccf2f298b235bacd427a
```

Show the Starport admin:

```sh
> await starport.methods.admin().call()
'0x046231a12d30248bAD3322Af74CEA9c325627D32'
```
This patch adds a test that currently shows the danger of our a re-org. We will use this as one of the bases to test that our new work on re-org resistance is effective in real-life scenarios.
* stub

* Progress debugging

* add first weights benchmark

* receive event debug

* publish sig

Co-authored-by: Jared Flatow <[email protected]>
This patch deploys a new Starport with the Timelock as the admin, which is the current Starport Impl now used for test-net. We add a script to make it fairly easy to deploy a new Starport implementation.
This patch adds a set of macros to derive types.json automatically. This is, all in all, a little complicated because the best way to analyze the code is through macros (since we can easily mark types that need to be exported) but macros, for obvious reasons, are run at compile-time and are not _meant_ to be side-effecty. That is, you can't easily just store a bunch of global data and when you're finished just emit it. Instead, we truncate and re-write a file-system temp file each time we encounter a new type and eventually we stop encountering new ones and we're good. We do this separately for each project in `scripts/build_types.json` since partial compilation and project-by-project compilation makes this even harder to do. We also need to clean and rebuild each time to ensure every macro is run. _Also_ there is some compile time slowness added here since I can't seem to remove the macros via features or other settings since this runs in the same layer as those types of tools. All-in-all, it's significantly fast enough and hopefully will make the process of updating our types.json trivial going forward.

Note: some of the code is pretty spaghetti in the derive code itself and can be upgraded over time. The issue is that there is a ton of possibilities that could occur in the syntax and we probably don't want to handle all of them.

The most complex one that we need to consider is `WIDTH` which, as a const, is not very easy to determine its value, so for now, we just use its value directly, since literals are fairly easy.

Note: the goal of `types-derive` is that it is generic and can be added to substrate's core, so we try to avoid "Gateway-specific" features in the code.
@hayesgm hayesgm requested a review from jflatow April 7, 2021 22:31
@github-actions
Copy link

github-actions bot commented Apr 7, 2021

🫖 [View Integration Test Results](server error: invalid xunit xml)

@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Apr 7, 2021

🫖 View Test Results

@github-actions

This comment has been minimized.

toninorair and others added 3 commits April 9, 2021 09:22
* account liqudity api experiment

* add gateway namespace, add portfolio endpoint

* playbook to update binary on full nodes ( update rpc )

* add exec trx request to repl
* add sorting of trx requests in transaction pool

format

re-remove split_once directive

* fix test

* fix test
@hayesgm hayesgm marked this pull request as draft April 12, 2021 18:16
hayesgm added 3 commits April 14, 2021 12:31
* Start to Improve Scenarios as Regression Tests

This patch starts to improve scenarios so that they can pass consistently. We make a few changes:

1. We add a `QUIET_SCENARIOS` flag that pushes all scenario output to temp files. This makes it possible to run scenarios and see the output and not 1,000 pages of validator text.
2. We add an `EventTracker` module that handles tracking events without using global vars (which was probably messing up test cases). Events are hard because they come in from a subscription in PolkadotJS, but our scenarios often ask "Have you seen any Substrate `Lock()` events?" and we have to say something like "Yes, we saw one more recently than the last time you asked." That can be a bit tricky and now that state is encapsulated and doesn't leak from one scenario to the next (this may have been a large bug in running sequential tests).
3. We start to move back away from `--runInBand` which means tests will run in separate processes and concurrently again. We may want to make it easier to not run in band for building tests (it's just a matter of passing the flag, but engineers might forget/not know how to do this, so we should make that clear).
4. We remove `only: true` and start to add back multiple tests so we can measure what is working and not. So far the results are not too excessively shabby.

* Continue to fix integration tests

* Add RPC decoration to preclude warnings

* Make scenarios quiet in CI

* Fix line number errors

* Track sleeps for better teardown procedure

* Try to quiet them down

* Increase timeout

* Try again

* Get more tests passing

* Get last upgrade scen working again

* Finish prices tests

* Add complex scenario for borrow cash interest

* Add features for integration mode

* More cleanup and fixes

* Clean up Gov tests

* Clean up more tests, including prices

* Fix some types issues and merge conflicts

* It was always a String, let's make it so
* Liquidation Scenarios

This patch starts to build a full array of liquidation scenarios and starts to uncover some buggy behavior. There are still more tests to write, but we'll need to fix the specification in regards to close factor limitations and healthiness checks.

* Add final liquidation tests
@github-actions
Copy link

🫖 [View Integration Test Results](server error: invalid xunit xml)

@github-actions

This comment has been minimized.

@github-actions
Copy link

🫖 View Test Results

@github-actions
Copy link

Unit Test Results

    1 files    24 suites   0s ⏱️
193 tests 193 ✔️ 0 💤 0 ❌
195 runs  195 ✔️ 0 💤 0 ❌

Results for commit db1c1c6.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants